// Multicast Sender

import java.io.*;
import java.net.*;


public class MulticastSender
{

  public static void main( String[] args )
  {

    MulticastSocket s;
    InetAddress group;

    if(args.length != 1) 
    {
       System.out.println(" You must enter the message to send on command line" );
       System.exit(0);

    }

   try{
        group = InetAddress.getByName("239.1.2.3");
        s = new MulticastSocket( 5321);
        s.setTimeToLive( 32 );
        String msg = args[0];
        System.out.println(msg);
  
        DatagramPacket packet = new DatagramPacket( msg.getBytes(), msg.length(), group, 54321);

        s.send( packet );
        s.close();

       } catch( Exception e )
         {

            e.printStackTrace();

         }

  }//End main




}//End MulticastSender
